00001
00002
00003
00004 #pragma once
00005 #include <string>
00006 using namespace std;
00007 #ifndef BUILDING_H
00008 #define BUILDING_H
00009
00012 class building{
00013
00014 int id;
00015 int life;
00016 char * model;
00017 int texture;
00018 int size;
00019 int xPos;
00020 int zPos;
00021
00022 public:
00023 building();
00024 building(int i, int l, char * m,int t, int s, int x, int z);
00025 void destroyBuilding();
00026 void decreaseLife(int l);
00027 void newBuilding();
00028
00029 };
00030 #endif
00031
00032
00033 #include "DarkGDK.h"
00034 #include <string>
00035
00036
00037 using namespace std;
00038
00039
00040
00041 building::building()
00042 {
00046 id = 0;
00047 life = 0;
00048 model = NULL;
00049 texture = 0;
00050 size = 0;
00051 xPos = 0;
00052 zPos = 0;
00053
00054
00055
00056 }
00057
00058 building::building(int i, int l, char * m, int t, int s, int x, int z)
00059 {
00065 id = i;
00066 life = l;
00067 model = m;
00068 texture = t;
00069 size = s;
00070 xPos = x;
00071 zPos = z;
00072 newBuilding();
00073
00074
00075 }
00076
00077 void building::newBuilding(){
00082
00083
00084
00085
00087
00088
00089
00090 dbLoadObject( model ,id );
00091 dbPositionObject(id, xPos, 0,zPos);
00092 dbScaleObject(id, size, size, size);
00093
00094 dbTextureObject(id, texture);
00095
00096
00097 }
00098
00099
00100 void building::destroyBuilding(){
00104 dbDeleteObject(id);
00105 }
00106
00107
00108 void building::decreaseLife(int l){
00113 life = life - l;
00114 if(life <= 0){
00115 destroyBuilding();
00116 }
00117
00118 }